<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值</title>
</head>
<body>
<p>解构:把整体拆分成组件,机器人的对象=>解构=>头+身体+肚子+四肢</p>
<script>
    // 传统的赋值
    var a =1,b = 2,c = 3;
    console.log(a,b,c);

    // 数组的解构赋值[]
    var [x,y,z] = [7,8,9];
    console.log(x,y,z);

    // 对象的赋值
    var user = {name:"霏霏",age:18,address:"新乡"}
    // 传统的对象属性赋值
    var username = user.name;
    var userage = user.age;
    var useraddress = user.address;
    console.log(username,userage,useraddress);

    // ES6的对象结构赋值{对象的属性}
    var {name,age,address} = user;
    var {address} = user;
    console.log(name,age,address);
</script>
</body>
</html>